-
-
Notifications
You must be signed in to change notification settings - Fork 39.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial potentiometer support #22449
base: develop
Are you sure you want to change the base?
Conversation
quantum/potentiometer.c
Outdated
uint16_t value = analogReadPin(potentiometer_pads[index]); | ||
if (value != potentiometer_state[index]) { | ||
potentiometer_state[index] = value; | ||
changed |= true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One potential problem here is that the raw analog readings may be noisy; although the user code can filter the raw values to remove that noise, this won't affect the changed
flag, which is then used to wake up OLEDs. Not sure how to implement the support for such filtering here while also keeping the common case simple; ideally potentiometer_update_user()
should be able to decide whether the analog input activity is actually significant, but there is no good way to return that data from there without adding some pointer argument.
(In the most generic case the user filtering code may also want to see all readings, including the ones which were completely identical to the previous value, so that it can distinguish that case from a delay between readings.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filtering was something I was planning to add, and the implementation there is mostly just a stub till a few other things are decided.
The main one being if this would be better as just a high level api to the adc driver. The assumptions that can be made, especially user facing ones, are somewhat simpler if its just for pots.
1ffbaae
to
d8e97ab
Compare
Description
Raising for visibility.
TODO
analog
rather thanpotentiometer
feature?Types of Changes
Issues Fixed or Closed by This PR
Checklist